Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set LEVEL_DETECTOR_SPL_8BIT_000_POINT to 52.0 dB. #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

microbit-carlos
Copy link
Contributor

@microbit-carlos microbit-carlos commented Sep 17, 2024

This is the value currently used by MakeCode:
https://github.com/microsoft/pxt-microbit/blob/v7.1.3/libs/microphone/microphone.cpp#L8

And MicroPython:
https://github.com/microbit-foundation/micropython-microbit-v2/blob/v2.1.2/src/codal_app/codal.json#L16

The reason to change it is that the LevelDetectorSPL() minValue default parameter is already 52:

LevelDetectorSPL(DataSource &source, float highThreshold, float lowThreshold, float gain,
float minValue = 52,
uint16_t id = DEVICE_ID_SYSTEM_LEVEL_DETECTOR_SPL,
bool activateImmediately = true);

MicroBitAudio also sets it to the same value 52.0:
https://github.com/lancaster-university/codal-microbit-v2/blob/v0.2.68/source/MicroBitAudio.cpp#L82

And LevelDetectorSPL will clamp as that being the min.

if (conv < minValue)
level = minValue;
else if (isfinite(conv))
level = conv;
else
level = minValue;

Fixes lancaster-university/codal-microbit-v2#449.

@finneyj
Copy link
Contributor

finneyj commented Feb 17, 2025

Thanks @microbit-carlos. With the update sound work I've been working on, we should be able to get back to the 35db point on a microbit v2 though. I'll test if that's the case, and if so, suggest we revert back to 35db?

@finneyj
Copy link
Contributor

finneyj commented Feb 18, 2025

I've updated the code in the audio-refactor branch, and it does indeed now allow us to detect down to around 35db. Shall we leave this as it is, then accept the improved range when we merge that branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The value of LEVEL_DETECTOR_SPL_8BIT_000_POINT (32) will never be reached
2 participants